// pages/singer/singer.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        list:[
            {
                name:"推荐歌手",
                type:-1,
                area:-1,
                index:0,
            },
            {
                name:"华语男歌手",
                type:1,
                area:7,
                index:1,
            },
            {
                name:"华语女歌手",
                type:2,
                area:7,
                index:2,
            },
            {
                name:"华语组合",
                type:3,
                area:7,
                index:3,
            },
            {
                name:"欧美男歌手",
                type:1,
                area:96,
                index:4,
            },
            {
                name:"欧美女歌手",
                type:2,
                area:96,
                index:5,
            },
            {
                name:"欧美组合",
                type:3,
                area:96,
                index:6,
            },
            {
                name:"日本男歌手",
                type:1,
                area:8,
                index:7,
            },
            {
                name:"日本女歌手",
                type:2,
                area:8,
                index:8,
            },
            {
                name:"日本组合",
                type:3,
                area:8,
                index:9,
            },
            {
                name:"韩国男歌手",
                type:1,
                area:16,
                index:10,
            },
            {
                name:"韩国女歌手",
                type:2,
                area:16,
                index:10,
            },
            {
                name:"韩国组合",
                type:3,
                area:16,
                index:12,
            },
            {
                name:"其他男歌手",
                type:1,
                area:0,
                index:13,
            },
            {
                name:"其他女歌手",
                type:2,
                area:0,
                index:14,
            },
            {
                name:"其他组合",
                type:3,
                area:16,
                index:15,
            }
        ],
        sel:{
            name:"推荐歌手",
            type:-1,
            area:-1,
            index:0
        },
        api:require("../web/api/apiurl"),
        content:null
    },
    selindx(e){
        console.log(e);
        this.setData({
            sel:this.data.list[e.currentTarget.dataset.index]
        })
        this.req()
    },
    goperson(e){
        console.log(e.currentTarget.dataset);
        wx.navigateTo({
          url: '/pages/person/person?value='+e.currentTarget.dataset.index,
        })
    },
    req(){
        /* console.log(this.data.sel);
        console.log(); */
        let requrl = this.data.api.artistlist+"type="+this.data.sel.type+"&area="+this.data.sel.area
        wx.request({
          url: requrl,
          success:res=>{
              console.log(res.data.artists);
              this.setData({
                  content:res.data.artists
              })
          }
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        this.req()
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})